package Java1227;
// this和super
// this：表示当前类的对象。
// super：表示父类的引用。

class J {
    int x = 2;
}

public class I extends J {
    int x = 3;

    void m() {
        System.out.println(this.x);
        System.out.println(super.x);
    }

    public static void main(String[] args) {
        I a = new I("张三", 30);
        I b = new I("李四", 40);
        b.m();
    }

    String name;
    int age;

    public I() {
    }

    public I(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "I{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

}
